package org.jetlinks.community.mstn.entity.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.jetlinks.community.auth.entity.OrganizationEntity;
import org.jetlinks.community.auth.entity.RoleEntity;

import java.util.Map;

@Data
public class ProjectDetailResVO {


    @Schema(description = "用户ID")
    private String userId;

    @Schema(description = "租户ID")
    private String orgId;

    @Schema(description = "租户套餐ID")
    private String roleId;

    @Schema(description = "项目名称")
    private String name;

    @Schema(description = "说明")
    private String describe;

    @Schema(description = "其他配置")
    private Map<String, Object> properties;

    @Schema(description = "过期时间")
    private Long expireTime;

    private RoleEntity roleInfo;


    public static ProjectDetailResVO of(OrganizationEntity organization) {
        ProjectDetailResVO vo = new ProjectDetailResVO();
        vo.setOrgId(organization.getId());
        vo.setName(organization.getName());
        vo.setDescribe(organization.getDescribe());
        vo.setProperties(organization.getProperties());
        vo.setExpireTime(organization.getExpireTime());
        vo.setUserId(organization.getContactUserId());
        return vo;
    }
}
